package com.zhixin.fans.ks.ui.base;

import android.content.Intent;
import android.os.Bundle;

import com.zhixin.fans.ks.CoupleApp;
import com.zhixin.fans.ks.dagger.components.CoupleAppComponent;
import com.zhixin.fans.ks.ui.login.LoginActivity;

import org.eenie.common.base.BaseActivity;
import org.eenie.common.base.BaseApp;
import org.eenie.common.dagger.components.AppComponent;

public abstract class BaseNeedLoginActivity extends BaseActivity {
    public AppComponent getApplicationComponent() {
        return ((BaseApp) getApplication()).getApplicationComponent();
    }

    public CoupleAppComponent getCoupleAppComponent() {
        return ((CoupleApp) getApplication()).getCoupleAppComponent();
    }



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if (!((CoupleApp) getApplicationContext()).getCoupleAppComponent().getUserInfoManager().isLogin()) {
            startActivity(new Intent(this, LoginActivity.class));
            finish();
        }
        super.onCreate(savedInstanceState);
    }
}
